<?php
/**
 * Created by IntelliJ IDEA.
 * User: keke
 * Date: 18-10-24
 * Time: 上午11:37
 */
require_once "../congfig/config.php";
require_once "../lib/common.php";

session_start();
checkLogined();
$pName = $_POST['pName'];
$pChar = $_POST['pChar'];
$teacher = $_POST['teacher'];
$pDesc = $_POST['pDesc'];
$pRank = $_POST['pRank'];

$sql = "select username from proinfor where pName = '$pName'";

$query = $conn->query($sql);
$num = $query->num_rows;
if ($num === 1) {
    exit (jsoncall(-1, "项目已经存在"));
}
$sql = "INSERT INTO VALUES (null ,'$pName','$pChar','$teacher','$pDesc',current_date(),'$pRank',null)";
$query = $conn->query($sql);
if ($query) {
    exit (jsoncall(1, "申请项目成功"));
} else {
    exit (jsoncall(-1, "申请项目失败"));
}



